package cn.edu.gxu.oas.module.run.dal.mysql.department;

import java.util.*;

import cn.edu.gxu.oas.framework.common.pojo.PageResult;
import cn.edu.gxu.oas.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.edu.gxu.oas.framework.mybatis.core.mapper.BaseMapperX;
import cn.edu.gxu.oas.module.run.dal.dataobject.department.DepartmentDO;
import org.apache.ibatis.annotations.Mapper;
import cn.edu.gxu.oas.module.run.controller.admin.department.vo.*;

/**
 * 学院 Mapper
 *
 * @author 源码
 */
@Mapper
public interface DepartmentMapper extends BaseMapperX<DepartmentDO> {

    default PageResult<DepartmentDO> selectPage(DepartmentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DepartmentDO>()
                .likeIfPresent(DepartmentDO::getName, reqVO.getName())
                .eqIfPresent(DepartmentDO::getCode, reqVO.getCode())
                .eqIfPresent(DepartmentDO::getSort, reqVO.getSort())
                .betweenIfPresent(DepartmentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DepartmentDO::getId));
    }

}